package com.fmenu.system.service.impl;

import java.util.List;
import com.fmenu.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fmenu.system.mapper.BnsDishesMapper;
import com.fmenu.system.domain.BnsDishes;
import com.fmenu.system.service.IBnsDishesService;

/**
 * 菜品Service业务层处理
 * 
 * @author zhangrui
 * @date 2021-12-22
 */
@Service
public class BnsDishesServiceImpl implements IBnsDishesService 
{
    @Autowired
    private BnsDishesMapper bnsDishesMapper;

    /**
     * 查询菜品
     * 
     * @param dishesId 菜品主键
     * @return 菜品
     */
    @Override
    public BnsDishes selectBnsDishesByDishesId(Long dishesId)
    {
        return bnsDishesMapper.selectBnsDishesByDishesId(dishesId);
    }

    /**
     * 查询菜品列表
     * 
     * @param bnsDishes 菜品
     * @return 菜品
     */
    @Override
    public List<BnsDishes> selectBnsDishesList(BnsDishes bnsDishes)
    {
        return bnsDishesMapper.selectBnsDishesList(bnsDishes);
    }

    /**
     * 新增菜品
     * 
     * @param bnsDishes 菜品
     * @return 结果
     */
    @Override
    public int insertBnsDishes(BnsDishes bnsDishes)
    {
        bnsDishes.setCreateTime(DateUtils.getNowDate());
        return bnsDishesMapper.insertBnsDishes(bnsDishes);
    }

    /**
     * 修改菜品
     * 
     * @param bnsDishes 菜品
     * @return 结果
     */
    @Override
    public int updateBnsDishes(BnsDishes bnsDishes)
    {
        bnsDishes.setUpdateTime(DateUtils.getNowDate());
        return bnsDishesMapper.updateBnsDishes(bnsDishes);
    }

    /**
     * 批量删除菜品
     * 
     * @param dishesIds 需要删除的菜品主键
     * @return 结果
     */
    @Override
    public int deleteBnsDishesByDishesIds(Long[] dishesIds)
    {
        return bnsDishesMapper.deleteBnsDishesByDishesIds(dishesIds);
    }

    /**
     * 删除菜品信息
     * 
     * @param dishesId 菜品主键
     * @return 结果
     */
    @Override
    public int deleteBnsDishesByDishesId(Long dishesId)
    {
        return bnsDishesMapper.deleteBnsDishesByDishesId(dishesId);
    }
}
